<script type="text/javascript">
var paging = new function(){
	
	this.prePage = function(){
		paging.changePageSize();
		var $val = document.getElementById("pageIndex");
		var val = parseInt($val.value);
		if(val <= 1){
			$val.value = 1;
		}else{
			$val.value = --val;
		}
		"${function}";
	};
	
	this.nextPage = function(){
		paging.changePageSize();
		var $maxVal = document.getElementById("maxPageIndex");
		var maxVal = parseInt($maxVal.value);
		var $val = document.getElementById("pageIndex");
		var val = parseInt($val.value);
		if(val >= maxVal){
			$val.value = maxVal;
		}else{
			$val.value = ++val;
		}
		"${function}";
	};
	
	this.gotoPage = function(){
		paging.changePageSize();
		var $maxVal = document.getElementById("maxPageIndex");
		var maxVal = parseInt($maxVal.value);
		var $val = document.getElementById("pageIndex");
		var val = parseInt($val.value);
		
		if(isNaN(val) || val <1){
			$val.value = 1;
		}else if(val >= maxVal){
			$val.value = maxVal;
		}
		"${function}";
	};
	
	this.changePageSize = function(){
		var $val = document.getElementById("pageSize");
		var val = parseInt($val.value);
		var $maxVal = document.getElementById("maxPageSize");
		var maxVal = parseInt($maxVal.value);
		if(isNaN(val) || val < 1){
			$val.value = maxVal/2;
			 return ;
		}else if(val > maxVal){
			$val.value = maxVal;
			 return;
		}
	};
	
	this.changePageIndex = function(){
		var $val = document.getElementById("pageIndex");
		var val = parseInt($val.value);
		var $maxIndex = document.getElementById("maxPageIndex");
		var maxIndex = parseInt($maxIndex.value);
		if(isNaN(val) || val < 1){
			$val.value =1;
			 return;
		}else if(val > maxIndex){
			$val.value = maxIndex;
			return;
		}
	};
}
</script>
<style>
#pagingLeft{float:left;}
#pagingLeft .text {color: #FD6C0F;}
#pagingRight{border: medium none;float: right;margin-bottom: 0;margin-right: 5px;width: auto;}
#pagingRight td {border: medium none;height: 18px;text-align: center;}
#pagingRight a{background-color: #EFEFEF;border-radius: 3px 3px 3px 3px; border: 1px solid #D0CDC9;color: #0066CC; text-decoration:none; display: block;font-size: 10px;height:12px; padding: 3px 8px;}
#pagingRight a:hover{background-color: #DFDFDF;border-radius: 3px 3px 3px 3px; border: 1px solid #D0CDC9;color: #E69303;text-decoration:none;display: block;font-size: 10px;height:12px; padding: 3px 8px;}
#pagingRight input{height:18px;margin-right:5px;width:30px;}
</style>
<div style="width:970px;height:30px">
<span id="pagingLeft">
<#if showTotalCount>
共
<span class="text">${totalCount}</span>
条记录
<span> | </span>
</#if>
<#if showPageCount>
第
<span class="text"> ${currentPageIndex}/${pageCount} </span>
页
</#if>
</span>
<table id="pagingRight">
	<tbody>
		<tr>
			<td>
				每页 <input type="text" id="pageSize"  name="pageSize"  value="${pageSize}" onchange="paging.changePageSize()">条记录
				<input type="hidden" id="maxPageSize" name="maxPageSize" value="${maxPageSize}" >
				<input type="hidden" id ="maxPageIndex" name="maxPageIndex" value="${pageCount}" >
			</td>
			<td><a  onclick="paging.prePage()" href="javascript:void(0);" >上一页</a></td>
			<td><a  onclick="paging.nextPage()" href="javascript:void(0);">下一页</a></td>
			<td>第 <input type="text"  id="pageIndex" name="pageIndex" value="${currentPageIndex}"  onchange="paging.changePageIndex()"></td>
			<td><a onclick="paging.gotoPage(this);">转到</a></td>
		</tr>
		
	</tbody>
</table>
</div>